#!/bin/sh

# resetWireless.sh
# SetupWireless
#
# Created by Jeff Dyck on 07/10/08.
# Copyright 2008 __MyCompanyName__. All rights reserved.

# Define some handy variables...

LocalUser=`whoami`
HOME=`dscl . -read /Users/$LocalUser home | sed -e 's|dsAttrTypeNative:home: ||g'`


# DYNAMICALLY SET THE LEOPARD UUID FOR THE BYHOST FILE NAMING
if [[ `ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50` == "00000000-0000-1000-8000-" ]]; then
	LEOUUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c51-62 | awk {'print tolower()'}`
elif [[ `ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50` != "00000000-0000-1000-8000-" ]]; then
	LEOUUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62`
fi

# Define the 3 plist files for easier reference...
AirportPref=/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
EAPProfiles="$HOME/Library/Preferences/com.apple.eap.profiles.plist"
EAPBindings="$HOME/Library/Preferences/ByHost/com.apple.eap.bindings.$LEOUUID.plist"

# Now delete the 3 preference files !!

rm "$AirportPref"
rm "$EAPProfiles"
rm "$EAPBindings"


exit 0